<?php
//Error_reporting(0); //uncomment here when upload site.
global $base_url;
$base_url = 'http://'.$_SERVER["HTTP_HOST"].'/handymoby/';
function baseURL(){
    return 'http://'.$_SERVER["HTTP_HOST"].'/handymoby/';
}
//call when you need to generate index url, created by Huong Nguyen
function generateURL($tail){
    return baseURL().$tail;
}


//call when you need to generate header, created by Huong Nguyen
function loadHeaderWithOption($header_name='Handy Moby-Home Page',$arrayJS=''){
  $_jsExtend ='';
  if(is_array($arrayJS)){
    for($i =0;$i<sizeof($arrayJS);$i++){
        $_jsExtend.='<script type="text/javascript" src="'.baseURL().'js/'.$arrayJS[$i].'"></script>';
    }
    }
    else{
        if(is_string($arrayJS)&&strlen($arrayJS)>1){
            $_jsExtend.='<script type="text/javascript" src="'.baseURL().'js/'.$arrayJS.'"></script>';
        }
    }
    $_title = $header_name;
    include("template/header.php");
}

function loadBodyAndFooter($bodyPathLeft = null,$bodyPathRight = null){
    
    echo '<body>';
    include('template/header_navigation.php');
    echo '<div class="wrapper">
	<div class="bground">';
    if(is_array($bodyPathLeft)){
        for($i = 0;$i<sizeof($bodyPathLeft);$i++){
            include($bodyPathLeft[$i]);
        }
    }

    if(is_string($bodyPathLeft)){
        include($bodyPathLeft);
    }
    if(is_string($bodyPathRight)){
        include($bodyPathRight);
    }
    echo '</div></div>';
    include("template/footer.php"); 
    echo '</body></html>';
}

function loadSignup(){
    //loadHeaderWithOption('Sign up');
    loadHeaderWithOption("HandyMobile-Sign Up",array('signup.js'));
    include('login/signup.php');
    include('template/footer.php');
}

function loadCustomFancy($title=''){
    echo '<div id="fancybox-title" class="fancybox-title-ptitle" style="display: block;width:100%;">
            <a id="fancybox-close" class="custom-fancy-close" style="display: inline;"></a>
            <div id="fancybox-title-ptitle" class="custom-fancybox-title">'.$title.'</div>
        </div><br/><br/><br/><br/><br/>';
}
function displayNoData($message){
    echo '<div class="nodata">'.$message.'</div>';
}
?>